<script type="text/javascript" charset="utf-8" src="<{$config.weburl}>/script/district.js" >
</script>
<script type="text/javascript" src="../script/jquery.validation.min.js"></script>
<script language="javascript">

var weburl="<{$config.weburl}>";
<{if $de.area}>
	<{assign var=area value=1}>
<{else}>
	<{assign var=area value=0}>
<{/if}>
$(function(){
	$('#form').validate({
		errorPlacement: function(error, element){
			element.next('.form-error').append(error);
		},      
		rules : {
			name:{
				required:true,
			},
			address:{
				required:true,
			},
			zip:{
				digits:true,
			},
			tel:{
				digits:true,
			},
			mobile:{
				required:true,
				digits:true,
			},
			<{if !$de.area}>
			select_1:{
				required:true,
			},
			select_2:{
				required:true,
			},
			select_3:{
				required:true,
			},
			<{/if}>
		},
		messages : {
			name:{
				required:'请填写收货人',
			},
			address:{
				required:'请填写街道地址',
			},
			zip:{
				digits:'请填写正确邮编',
			},
			tel:{
				digits:'请填写正确电话',
			},
			mobile:{
				required:'请填写手机号',
				digits:'请填写正确手机号',
			},
			
			<{if !$de.area}>
			select_1:{
				required:'请选择所属区域',
			},
			select_2:{
				required:'请选择所属区域',
			},
			select_3:{
				required:'请选择所属区域',
			},
			<{/if}>
		}
	});
});
</script>
<div class="path">
    <div>
    	<{if $cg_u_type==1}>
    		<a href="main.php?cg_u_type=1">我的商城</a> <span>&gt;</span>
        <{else}>
    		<a href="main.php?cg_u_type=2">卖家中心</a> <span>&gt;</span>
        <{/if}>
        <a href="main.php?m=member&s=admin_orderadder">收货地址</a> <span>&gt;</span>
        <{if $smarty.get.type=='add'}>新增收货地址<{elseif $smarty.get.type=='edit'}>编辑收货地址<{else}>收货地址列表<{/if}>
    </div>
</div>
<div class="main">
	<div class="wrap">
        <div class="hd">
            <ul class="tabs">
                <li class="<{if $smarty.get.type}>normal<{else}>active<{/if}>"><a href="main.php?m=member&s=admin_orderadder">收货地址列表</a></li>
                <li class="<{if $smarty.get.type=='add'}>active<{else}>normal<{/if}>"><a href="main.php?m=member&s=admin_orderadder&type=add">新增收货地址</a></li>
                <{if $smarty.get.type=='edit'}>
                <li class="active"><a href="main.php?m=member&s=admin_orderadder&type=edit">编辑收货地址</a></li>
                <{/if}>
            </ul>
        </div>
        <{if $smarty.get.type=='add' or $smarty.get.type=='edit'}>
        <div class="form-style">
            <form id="form" name="form" action="" method="post">
            <input type="hidden" value="<{$de.id}>" name="edid">
            <input type="hidden" value="<{if $de.id}>edit<{else}>add<{/if}>" name="submit">
           
            <dl>
                <dt><em>*</em>收货人：</dt>
                <dd><input maxlength="30" name="name" value="<{$de.name}>" class="text w150"> <div id="form-error" class="form-error"></div></dd>
            </dl>
            
            <dl>
                <dt><em>*</em>所在区域：</dt>
                <dd>
                <input type="hidden" name="t" id="t" value="<{$de.area}>" />
                <input type="hidden" name="province" id="id_1" value="<{$de.provinceid}>" />
                <input type="hidden" name="city" id="id_2" value="<{$de.cityid}>" />
                <input type="hidden" name="area" id="id_3" value="<{$de.areaid}>" />
               
                <{if $de.area}><div id="d_1"><{$de.area}>&nbsp;&nbsp;<a href="javascript:sd();">编辑</a></div><{/if}>
                
                <div id="d_2" <{if $de.area}>class="hidden"<{/if}>>
                    <select id="select_1" name="select_1" onChange="district(this);">
                    <option value="">--请选择--</option>
                    <{$prov}>
                    </select>
                    <select id="select_2" name="select_2" onChange="district(this);" class="hidden"></select>
                	<select id="select_3" name="select_3" onChange="district(this);" class="hidden"></select>
                	<div id="form-error" class="form-error"></div>
                </div>
                </dd>
            </dl>
            <dl>
                <dt><em>*</em>街道地址：</dt>
                <dd>
                	<input type="text" value="<{$de.address}>" name="address" id="address" class="w300 text"><div id="form-error" class="form-error"></div>
                    <p class="hint">不必重复填写所在地区</p>
               	</dd>
            </dl>
            <dl>
                <dt>邮政编码：</dt>
                <dd><input type="text" name="zip"  id="zip" maxlength="6" class="w80 text" value="<{$de.zip}>" ><div id="form-error" class="form-error"></div></dd>
            </dl>
            <dl>
                <dt>电话号码：</dt>
                <dd><input type="text" name="tel" id="tel" class="w150 text" value="<{$de.tel}>"><div id="form-error" class="form-error"></div></dd>
            </dl>
            <dl>
                <dt><em>*</em>手机号码：</dt>
                <dd><input type="text" name="mobile" id="mobile" maxlength="18" class="w150 text" value="<{$de.mobile}>"><div id="form-error" class="form-error"></div></dd>
            </dl>
            <dl class="foot">
                <dt>&nbsp;</dt>
                <dd><input type="submit" value="提交" class="submit"></dd>
            </dl>
            </form>
        </div>  
        <{else}>
        <table class="table-list-style">
            <thead>
            <tr>
                <th width="10"></th>
                <th class="tl" width="100">收货人</th>
                <th class="tl">所在区域</th>
                <th class="tl" width="100">邮编</th>
                <th class="tl" width="100">电话/手机</th>
                <th width="90">操作</th>
            </tr>
            </thead>
            <tbody>
            <{foreach item=list key=num from=$list}>
            <tr>
            	<td></td>
                <td class="tl"><{$list.name}></td>
                <td class="tl"><{$list.area}><{$list.address}></td>
                <td class="tl"><{$list.zip}></td>
                <td class="tl"><{$list.tel}><br />
                <{$list.mobile}></td>
                <td><a href="<{$config.weburl}>/main.php?m=member&s=admin_orderadder&id=<{$list.id}>&type=edit" >修改</a> <a href="<{$config.weburl}>/main.php?m=member&s=admin_orderadder&edid=<{$list.id}>">删除</a></td>
            </tr>
            <{foreachelse}>
            <tr>
            	<td colspan="20" class="norecord">
                	<i></i><span>暂无符合条件的数据记录</span>	
                </td>
            </tr>
            <{/foreach}>
            </tbody>
        </table>
        <{/if}>
     </div>   
</div>